package easymall.controller.admin;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;

import easymall.exception.AdminNoLoginException;
import easymall.exception.UserLoginNoException;

//拦截访问后台的登录请求
@Controller
public class AdminFilterController {
	@ModelAttribute
	public void isLogin(HttpSession session, HttpServletRequest request) throws AdminNoLoginException {
		if (session.getAttribute("admin") == null) {
			throw new AdminNoLoginException("请先登录！");
		}
	}
}
